package leetcode.editor.cn;

import java.util.ArrayList;
import java.util.List;

public class _78_Subsets {
    public static void main(String[] args) {
        Solution solution = new _78_Subsets().new Solution();
    }

    //leetcode submit region begin(Prohibit modification and deletion)
    class Solution {

        List<List<Integer>> res = new ArrayList<>();
        List<Integer> path = new ArrayList<>();

        private void dfs(int[] nums, int idx) {
            if (idx == nums.length) {
                res.add(new ArrayList<>(path));
                return;
            }

            dfs(nums, idx + 1);

            path.add(nums[idx]);
            dfs(nums, idx + 1);
            path.remove(path.size() - 1);
        }

        public List<List<Integer>> subsets(int[] nums) {
            dfs(nums, 0);
            return res;
        }
    }
//leetcode submit region end(Prohibit modification and deletion)

}